/*
 * 中北大学软件学院
 */
package com.ychs.uolab.user.service;

import java.util.List;

import com.ychs.uolab.user.dao.UserDao;
import com.ychs.uolab.user.dao.UserDaoImpl;
import com.ychs.uolab.user.vo.User;

/**
 * 用户业务实现类;用户登录
 * 
 * @author djl
 * @version 1.0
 */
public class UserServiceImpl implements UserService {
	/**
	 * 创建UserDao对象，以使UserServiceImpl使用它.多态机制
	 */
	private UserDao userDao = new UserDaoImpl();

	@Override
	public boolean checkUser(String userName, String userPsw) {
		//调用UserDao中的方法login
		boolean flag = userDao.login(userName, userPsw);
		return flag;
	}

	@Override
	public boolean addUser(User user) {
		boolean flag = userDao.insertUser(user);
		return flag;
	}

	@Override
	public int modifyUser(User user) {
		int count = userDao.updateUser(user);
		return count;
	}

	@Override
	public int deleteUser(String userid) {
		int count = userDao.deleteUser(userid);
		return count;
	}

	@Override
	public List<User> findUser(String username, String dname, String major, String classes, String grade) {
		List<User> ulist = userDao.selsctUser(username, dname, major, classes, grade);
		return ulist;
	}

}
